package com.ypf.demo_ssm.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ypf.demo_ssm.utils.LocalDateConverter;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 
 * </p>
 *
 * @author 殷鹏飞
 * @since 2024-06-15
 */
@Getter
@Setter
@TableName("user")
public class User implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    @ExcelIgnore
    private String id;

    @TableField("username")
    @ExcelProperty("名称")
    private String username;

    @TableField("account")
    @ExcelProperty("账号")
    private String account;

    @TableField("password")
    @ExcelProperty("密码")
    private String password;

    @TableField("birthday")
    @ExcelProperty(value = "生日", converter = LocalDateConverter.class)
    @JSONField(format="yyyy-MM-dd")
    private LocalDate birthday;

    @TableField("sex")
    @ExcelProperty("性别")
    private String sex;

    @TableField("remarks")
    @ExcelProperty("备注")
    private String remarks;

    @TableField(value = "createtime", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private LocalDateTime createtime;

    @TableField(value = "updatetime", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @OrderBy(asc = false) // 指定默认排序为倒序
    @ExcelIgnore
    private LocalDateTime updatetime;

    @TableField("isadmin")
    @ExcelProperty("是否管理员")
    @ExcelIgnore
    private Integer isadmin;

    @TableField(value = "isdelete")
    @TableLogic
    @ExcelIgnore
    private Integer isdelete;
}
